# 构建php-fpm镜像
# 基础镜像：php:7.2.1-fpm
# dengqihua<1006236360@qq.com>

FROM php:7.2.1-fpm

ENV TZ=Asia/Shanghai

RUN set -xe; \
    # 设置系统时区
    ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime; \
    \
    apt-get update; \
    \
    # 安装 gd
    apt-get install -y libpng-tools libpng-dev libjpeg-dev libfreetype6-dev; \
    docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/; \
    docker-php-ext-install gd; \
    \
    echo "清理"; \
    apt-get purge -y --auto-remove; \
    rm -rf /var/cache/apt/*; \
    rm -rf /var/lib/apt/lists/*

RUN set -xe; \
    # 安装 mysqli pdo_mysql
    docker-php-ext-install mysqli pdo_mysql

RUN set -xe; \
    # 安装 opcache
    docker-php-ext-install opcache

RUN set -xe; \
    # 安装 redis
    pecl bundle -d /usr/src/php/ext redis; \
    rm -rf /usr/src/php/ext/redis-*.tgz; \
    docker-php-ext-install redis

    
